/**   
*    
* @file
* @brief
*
* @<b>文件名</b>      : AttachListParser
* @n@n<b>版权所有</b>: 网龙应用软件开发一部
* @n@n<b>作  者</b>  : Administrator
* @n@n<b>创建时间</b>: 2014-2-7 上午9:28:21 
* @n@n<b>文件描述</b>:  
* @version  
*/
package com.common.weibolib;

import java.util.List;

import org.json.JSONArray;
import org.json.JSONException;

import com.common.android.utils.parser.AbstractArrayParser;

/**
 * ClassName:AttachListParser
 * Function: TODO ADD FUNCTION
 * Reason:	 TODO 网龙微博API(新版)
 * 
 * @author   Administrator		
 * @version  
 * @since    Ver 1.1
 * @Date	 2014	2014-2-7		上午9:28:21
 *
 * @see 	 
 */

public class AttachListParser extends AbstractArrayParser<Attach> {

	@Override
	public AttachList parse(JSONArray array) throws JSONException {
		AttachList attachList = new AttachList();
		AttachParser parser = new AttachParser();
		for (int i = 0; i < array.length(); i++) {
			Attach attach = parser.parse(array.getJSONObject(i));
			attachList.add(attach);
		}
		
		return attachList;
	}

	@Override
	public JSONArray toJSONArray(List<Attach> group) throws JSONException {
		JSONArray jsonArray = new JSONArray();
		AttachParser attachParser = new AttachParser();
		for (Attach item : group) {
			jsonArray.put(attachParser.toJSONObject(item));
		}
		return jsonArray;
	}

}
